var mongoose = require("../common/db")

var mail = new mongoose.Schema({
	fromUser: String,
	toUser: String,
	title: String,
	context: String,
})

mail.statics.findByToUsername = function (toUser, callBack) {
	this.find({ toUser }, callBack)
}

mail.statics.findByFromUsername = function (fromUser, callBack) {
	this.find({ fromUser }, callBack)
}

var mailModel = mongoose.model("Mail", mail)

module.exports = mailModel
